package com.simple.editor;

import org.picocontainer.MutablePicoContainer;
import org.picocontainer.PicoBuilder;

/**
 * Created with IntelliJ IDEA.
 * User: vlad
 * Date: 6/2/13
 * Time: 5:20 PM
 * To change this template use File | Settings | File Templates.
 */
public class ApplicationContextImpl implements ApplicationContext {

    private final MutablePicoContainer picoContainer;

    public ApplicationContextImpl() {
        picoContainer = new PicoBuilder().withCaching().build();
    }

    public <T> T getComponent(final Class<T> tClass) {
        return picoContainer.getComponent(tClass);
    }

    public Object getComponent(final Object key) {
        return picoContainer.getComponent(key);
    }

    public void addComponent(final Object component) {
        picoContainer.addComponent(component);
    }

    public void removeComponent(final Object component) {
        picoContainer.removeComponent(component);
    }

    public void addComponent(final Object key, final Object component, final org.picocontainer.Parameter... parameters) {
        picoContainer.addComponent(key, component, parameters);
    }

}
